Magnetic disk drive and method for rewriting data block

ABSTRACT

According to one embodiment, a magnetic disk includes a disk, a controller and an indicator module. The disk includes a plurality of data sectors. The controller is configured to control data rewrite for reading a first data block stored in the disk and writing a second data block corresponding to the read first data block to a write destination on the disk. The indicator module is configured to embed an indicator indicative of an attribute relating to data rewrite in each sector data in the second data block written to the write destination when the each sector data is written to the write destination.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is based upon and claims the benefit of priority fromJapanese Patent Application No. 2010-125137, filed May 31, 2010; theentire contents of which are incorporated herein by reference.

FIELD

Embodiments described herein relate generally to a magnetic disk driveand a method for rewriting a data block.

BACKGROUND

In general, in a magnetic disk drive, a mass of data stored in the disk,what is called a data block, is rewritten by, for example, migration.The migration of a data block is executed by the following procedure.Here, it is assumed that a data block stored in a first area of the diskis migrated to a second area of the disk. In this case, first, the datablock is read from the first area of the disk. Then, the read data blockis written to the second area of the disk. Alternatively, a part of theread data may be replaced with write data specified by a host, and thereplaced data may then be written to the second area.

Because of the data block migration, when the data block is read fromthe first area, a read error may occur. Here, it is assumed that thefirst area comprises a plurality of sectors (data sectors) including asector SA. It is further assumed that when data (sector data) in thesector SA is read, a read uncorrectable error occurs which cannot becorrected based on an error correction code (ECC). It is also assumedthat the second area comprises a plurality of sectors including a normalsector SA′ and that the relative position of the sector SA′ in thesecond area coincides with that of the sector SA in the first area.

Even when an error occurs in data read from the sector SA, if the datablock is written to the second area, then after the write of the datablock, the content of the sector SA′ is different from that of thesector SA. Thereafter, if the data in the sector SA′ is read, forexample, in accordance with a request from the host, since the sectorSA′ is normal, the data read is very likely to be achieved normally. Inthis case, data different from that written to the sector SA, that is,incorrect (invalid) data (sector data) is returned from the magneticdisk drive to the host. However, not only the host but also the magneticdisk drive has difficulty determining that the sector data read from thesector SA′ is incorrect.

Furthermore, power to the magnetic disk drive may be shut down duringthe write of the data block to the second area. Thus, there has been ademand for the capability of detecting possible power shutdown duringthe write of the data block.

BRIEF DESCRIPTION OF THE DRAWINGS

A general architecture that implements the various features of theembodiments will now be described with reference to the drawings. Thedrawings and the associated descriptions are provided to illustrate theembodiments and not to limit the scope of the invention.

FIG. 1 is a block diagram showing an exemplary configuration ofelectronic device comprising a magnetic disk drive according to a firstembodiment;

FIG. 2 is a conceptual drawing showing an example of a format includingthe track arrangement of a disk applied in the first embodiment;

FIG. 3 is a diagram showing an example of a sector data format appliedin the first embodiment;

FIG. 4 is a diagram illustrating an exemplary data rewrite according tothe first embodiment;

FIG. 5 is a flowchart showing an exemplary procedure of a data blockmigration process applied in the first embodiment;

FIG. 6 is a flowchart showing an exemplary procedure of a data readprocess applied in the first embodiment;

FIG. 7 is a diagram showing an example of a sector data format appliedin a second embodiment;

FIG. 8 is a flowchart showing an exemplary procedure of a data blockmigration process applied in the second embodiment;

FIG. 9 is a diagram illustrating a principle for identification of asector where processing has been suspended as a result of power shutdownduring the data block migration process;

FIG. 10 is a flowchart showing an exemplary procedure of a data readprocess applied in the second embodiment;

FIG. 11 is a diagram illustrating an exemplary write of write data to anonvolatile cache area reserved on the disk;

FIG. 12 is a flowchart showing an exemplary procedure of a process ofwriting data to the nonvolatile cache area which process is applied in athird embodiment;

FIG. 13 is a flowchart showing an exemplary procedure of a process ofreading data from the nonvolatile cache area which process is applied inthe third embodiment; and

FIG. 14 is a diagram showing a modification of a sector data format.

DETAILED DESCRIPTION

Various embodiments will be described hereinafter with reference to theaccompanying drawings. In general, according to one embodiment, amagnetic disk comprises a disk, a controller and an indicator module.The controller is configured to control data rewrite for reading a firstdata block stored in the disk and writing a second data blockcorresponding to the read first data block to a write destination on thedisk. The indicator module is configured to embed an indicatorindicative of an attribute relating to data rewrite in each sector datain the second data block written to the write destination when the eachsector data is written to the write destination.

FIG. 1 is a block diagram showing an exemplary configuration ofelectronic device comprising a magnetic disk drive according to a firstembodiment. In FIG. 1, the electronic device comprises a magnetic diskdrive (HDD) 10 and a host 100. The electronic device is, for example, apersonal computer, a video camera, a music player, a mobile terminal, ora mobile phone. The host 100 utilizes HDD 10 as a storage device for thehost 100. The host 100 is connected to HDD 10 (more specifically, acontroller CNT in HDD 1 which will be described below) via a hostinterface 101.

In a first embodiment, it is assumed that well-known shingled write isapplied to HDD 10. HDD 10 comprises a disk (magnetic disk) 11 as arecording medium. The disk 11 comprises two disk surfaces, an upper disksurface and a lower disk surface. The upper disk surface if the disk 11forms a recording surface on which data is magnetically recorded. A head(magnetic head) 12 is located over the recording surface of the disk 11.The head 12 includes a write element and a read element and is used towrite data to the disk 11 and to read data from the disk 11. Forconvenience of drawing, FIG. 1 shows an example HDD 10 with one head 12.However, the two disk surfaces of the disk 11 may both form recordingsurfaces, and heads may be arranged over the respective disk surfaces.Furthermore, in the configuration in FIG. 1, the HDD is assumed tocomprise the single disk 11. However, the HDD may comprise a pluralityof stacked disks.

FIG. 2 is a conceptual drawing showing an example of a format includinga disk track arrangement and applied in the first embodiment. As shownin FIG. 2, the recording surface of the disk 11 is divided into areas A₀to A₅ in the radial direction of the disk 11. A given number of tracksare arranged in each of the areas A₀ to A₅. For convenience, FIG. 2shows only tracks arranged in the area A₅ located on the innercircumferential side of the disk 11. The tracks arranged in the otherareas A₀ to S₄ are omitted.

Furthermore, in the first embodiment, the areas A₀ to A₅ are groupedinto sets each of a given number of areas. In the example in FIG. 2, aset of the areas A₀ to A₂ forms a group G0. A set of the areas A₃ to A₅forms a group G1. Furthermore, in each group Gi (i=0, 1), one area isassigned as a free space used as a migration destination (rewritedestination) to which data in the tracks in another area in the group Giis migrated during shingled write. When the data migration (rewrite) iscompleted, an area corresponding to a data migration source is newlyassigned as a free space.

In the example in FIG. 2, the recording surface of the disk is dividedinto six areas. However, the recording surface may be divided into, forexample, more than six areas instead of being divided into six areas.Furthermore, in the example in FIG. 2, each group comprises three areas.However, each group may comprise more than one area, for example, morethan three areas.

Each of the tracks on the disk 11 comprises a plurality of data sectors(hereinafter simply referred to as sectors). FIG. 3 shows an example ofa sector data format. The sector mainly comprises a user data field, anindicator (INDI) field, and an ECC (Error Correction Code) field. Theuser data field is used to record user data. The indicator field is usedto record an indicator INDI indicative of an attribute of thecorresponding sector field. The indicator INDI is attribute dataincluding read uncorrectable bit (UNC) indicative of a readuncorrectable attribute. The rewrite of sector data is not limited tothe updating of the sector data. For example, the rewrite of sector dataalso includes write of sector data read from one sector to the samesector again or to another sector corresponding to the one sector.

FIG. 1 is referred to again. The disk 11 is spun at a high speed by aspindle motor (SPM) 13. The head 12 is attached to the tip of anactuator 14. The head 12 floats over the disk 11 as a result of thehigh-speed spin of the disk 11. The actuator 14 comprises a voice coilmotor (VCM) 15 serving as a driving source for the actuator 14. Theactuator 14 is driven by VCM 15 to move the head 12 in the radialdirection of the disk 11. The operation of the actuator 14 allows thedisk 11 to be positioned on a target track on the disk 11.

HDD 10 comprises a controller CNT. The controller CNT provides a hostinterface control function to control reception of commands (a writecommand, a read command, and the like) transferred by the host 10 via ahost interface 101 and transfer of data between the host 100 and thecontroller CNT. The controller CNT also provides a disk interfacecontrol function to control data transfer between the disk 11 and thecontroller CNT. The controller CNT also provides a buffer interfacecontrol function to control a buffer memory 19 described below.

In the first embodiment, the controller CNT is implemented by a systemLSI called SOC (System On Chip) and comprising a read IC 16, an ECCmodule 17, an indicator module 18, a buffer memory 19, and MPU(Microprocessor Unit) 20 all integrated on a single chip. Such aconfiguration of the controller CNT is illustrative, and for example,the buffer memory 19 may be provided outside the controller CNT.

The read IC 16 is connected to the head 12 via a head amplifier notshown in the drawings. The head amplifier includes a read amplifierconfigured to amplify a signal (read signal) reproduced by the head anda write driver configured to convert coded write data transferred by theread IC 16 into a write current (write signal) and then output the writecurrent to the head.

The read IC 16 is a well-known signal processing module called a readchannel or a read/write channel. The read IC 16 digitalizes a readsignal and decodes read data from the digitalized data (digital data).The read IC 16 also extracts servo data (servo patterns) from thedigital data. The read IC 16 also codes write data. The read IC 16 isconnected to the ECC module 17.

The ECC module 17 provides an ECC generation function to generate ECCbased on user data (more specifically user data with an indicator)transferred by the indicator module 18. The ECC module 17 adds ECC(generated ECC) to user data with an indicator, and transfers the userdata with the indicator and the ECC to the read IC 16. The ECC module 17also extracts the user data and ECC from the decoded read datatransferred by the read IC 16. Then, based on the extracted ECC, the ECCmodule 17 detects and corrects a possible error in the user data. TheECC module 17 is connected to the indicator module 18.

The indicator module 18 operates when a data block (first data block)stored in one area (first area) in the group Gi on the disk is rewrittenusing another area (free space or second area) in the group Gi. Theindicator module 18 adds the indicator INDI to the user data included ineach sector data in a data block (second data block) to be written tothe second area. The indicator INDI is indicative of an attributespecified by MPU 20. The indicator module 18 also operates when thefirst data block is read from the first area. The indicator module 18detects the indicator INDI with a valid read uncorrectable (UNC) bitwith a logical “1” in each sector data in the first data block.

The buffer memory 19 is used to temporarily store user data to bewritten to the disk 11. The buffer memory 19 is also used to temporarilystore user data read form the disk 11 via the read IC 16, the ECC module17, and the indicator module 18.

MPU 20 is a control module configured to control the read IC 16, the ECCmodule 17, and the indicator module 18 in accordance with a controlprogram stored in ROM or a flash ROM not shown in the drawings. MPU 20also controls SPM 13 and VCM 15 via a motor driver IC not shown in thedrawings.

Now, with reference to FIG. 4, the operation of the first embodimentwill be described taking, as an example, data rewrite executed when awrite access range specified by the host 100 corresponds to, forexample, a series of sectors in the area A0 belonging to the group G0.Here, for simplification of description, it is assumed that the amountof radial shift of the head during shingled write is half of the width Wof a write element included in the head 12. Furthermore, it is assumedthat the area A2 is assigned as a free space in the group G0.

The above-described data rewrite is executed by read of a data block(first data block) DB stored in the area A0 and write of a data block(second data block) DB′ to the area A2. The data block DB′ is the readdata block DB in which a part of the data block DB corresponding to theabove-described write access range is rewritten (that is, modified) withwrite data specified by the host 100, that is, what is called readmodify data. However, in the description below, for simplification, itis assumed that the data block DB is the same as the data block DB′.That is, it is assumed that the data block DB stored in the area (readtarget area) A0 is migrated to the area (write target area) A2.

FIG. 4 shows an example of migration of a data block from the area A0 tothe area A2 executed if the area A0 comprises tracks TR_1 to TR_4 and ifthe area (free space) A2 comprises tracks TR_N+1 to TR_N+4. Thecontroller CNT reads the data bock DB stored in the area A0 in units ofsectors. That is, the controller CNT sequentially reads sector data fromall the sectors in the tracks TR_1 to TR_4 provided in the area A0.Every time the sector data is read, the ECC module 17 in the controllerCNT extracts the user data and ECC from the read sector data. Then,based on the extracted ECC, the ECC module 17 then detects and correctsa possible error in the used data. The user data with the error detectedand corrected by the ECC module 17 is stored in the buffer memory 19 viathe indicator module 18.

Here, it is assumed that during the sector-wise read of data from thearea A0, a read error occurs in which sector data cannot be readnormally from the sector SA on the track TR_3 as shown in FIG. 4. It isthen assumed that the read error is of a read uncorrectable type inwhich an error in the user data included in the sector data read fromthe sector SA is uncorrectable. In the first embodiment, the logicaladdress (logical block address) of the sector SA is LBA “A”.

It is then assumed that when all of the data block DB is read from thearea (migration source area) A0, the read data block DB is written tothe area (migration destination area) A2. In the first embodiment, thearea A2 contains the normal sector SA′, and the relative position of thesector SA′ in the area A2 coincides with that of the sector SA with aread error. That is, the sector SA′ in the area A2 corresponds to thesector SA in the area A0.

When all of the data block DB is written to the area A2, that is, whenall of the data block DB is migrated from the area A0 to the area A2,then in the group G0, the free space is switched from the area A2 to thearea A0. Furthermore, the assignment destination of the logical blockaddress LBA “A” previously assigned to the sector SA in the area A0 isswitched from the sector SA to the sector SA′ in the area A2.

Moreover, it is assumed that after the migration of the data block DB isfinished, the host 100 instructs the controller CNT in HDD 10 to readdata positioned at the logical block address LBA “A”. In this case, thecontroller CNT reads the data in the sector SA′ in the area A2 as thedata positioned at the logical block address LBA “A”. Since the sectorSA′ is normal, it is very likely that the data read is achievednormally. In such a case, the data read from the sector SA′ is differentfrom that stored in the sector SA. Thus, incorrect data (sector data)may be returned to the host 100 by the controller CNT as normal datapositioned at the specified logical block address LBA “A”.

If the sector SA′ is temporarily entered, for example, in an existingdefect management table in order to avoid the above-described situation,the controller CNT can process the sector SA′ based on the recognitionthat the sector SA′ corresponds to an originally read-uncorrectablespecial sector. However, application of this method may even temporarilyincrease the number of sectors entered in the defect management table(that is, the number of sectors to be managed). Furthermore, if thedefect management table is filled with the many temporarily enteredsectors, even when a real defective sector is newly detected, it isdifficult to enter the real defective sector in the defect managementtable.

Thus, in the first embodiment, if sector data including one of the userdata stored in the buffer memory 19 for which a read operation hasresulted in an error is written to the sector SA′, the indicator module18 in the controller CNT adds the indicator INDI to the user data forwhich the read operation has resulted in the error. The indicator INDIincludes, for example, an instruction bit UNC with a logical “1”. Theinstruction bit UNC with a logical “1” indicates that the sector SA′ towhich the sector data including the indicator INDI is to be writtencorresponds to a special sector on which normal data read can originallynot be executed (that is, the special sector for which the read data isuncorrectable). In the description below, the instruction bit UNC isexpressed as the INDI [UNC] bit or INDI [UNC]. The instruction bit UNCwith the logical “1” is expressed as “INDI [UNC]=1”.

The ECC module 17 generates ECC based on the user data provided with theindicator INDI (more specifically, the indicator INDI with the INDI[UNC] bit) by the indicator module 18. The ECC module 17 adds thegenerated ECC to the user data provided with the indicator INDI. The ECCmodule 17 transfers the sector data including the user data providedwith the indicator INDI and ECC, to the read IC 16 as write data. Theread IC 16 codes the write data transferred by the ECC module 17. Thewrite data coded by the read IC 16 is converted into a write current bythe head amplifier. Based on the write current, the write data iswritten to the corresponding sector, that is, the sector SA′, by thehead 12.

FIG. 4 also shows that the write data (sector data) with “INDI [UNC]=1”is written to the sector SA′ in the area A2 on the disk 11. If suchwrite data (sector data) with “INDI [UNC]=1” (that is, the write data inwhich “INDI [UNC]=1” is embedded) is read, the indicator module 18 makesdetermination equivalent to that made by the ECC module 17. Thus, theindicator module 18 detects “INDI [UNC]=1” in the read sector data todetermine that the sector SA′ in which the sector data is stored is aspecial sector from which the data cannot be read normally (the readdata is uncorrectable). Thus, in the first embodiment, the attribute ofthe sector SA for which a read operation has resulted in an error isindicated by “INDI [UNC]=1” in the indicator INDI added to the user datawritten to the sector SA′ to which the data in the sector SA ismigrated.

When the indicator module 18 detects “INDI [UNC]=1” in the read sectordata, MPU 20 in the controller CNT executes error processing similar tothat executed if a read error is detected in the ECC nodule 17. That is,even if sector data is read normally from the sector SA′, MPU 20 canexecute error processing in the same manner as that used if the readerror is uncorrectable. Furthermore, in the first embodiment, such aspecial sector SA′ need not be manageably stored in a special table suchas the defect management table.

Additionally, if the data block written to the area A2 to which thesector SA′ belongs is migrated to the free space in the group G0 towhich the area A2 belongs, the controller CNT may copy the sector datain the sector SA′ including “INDI [UNC]=1” to the corresponding sectorin the free space without any change. This enables the attribute of thesector A to be inherited from the sector SA′ to the sector to which thesector data is migrated without the need to execute the process ofadding “INDI [UNC]=1”.

Now, the procedure of the data block migration process applied in thefirst embodiment will be described with reference to the flowchart inFIG. 5 taking, as an example, the case in which the data block DB ismigrated from the area A0 to the area A2 serving as a free space. First,MPU 20 in the controller CNT sets a read logical block address RLBAspecifying a read target sector (migration source sector) in the area(read target area) A0, to be a logical block address assigned to theleading sector in the area A0 (block 501). The logical block addressassigned to the leading sector in the area A0 is the leading logicalblock address (leading LBA) in the area A0. Furthermore, MPU 20 sets awrite logical block address WLBA specifying a sector (migrationdestination sector) in the area (write target area) A2 to which thesector data is to be written, to be the leading LBA which is a logicalblock address to be assigned to the leading sector in the area A2 (block502).

Then, MPU 20 sets the indicator module 18 to a first mode in which theindicator module 18 adds the indicator INDI including the INDI [UNC] bitwith a logical “0” (that is, INDI [UNC]=0) to the user data (block 503).MPU 20 then executes sector read to read sector data from the sector inthe area A0 indicated by the current read logical block address RLBA(block 504). The sector data read by the sector read is decoded by theread IC 16. The sector data decoded by the read IC 16 is transferred tothe ECC module 17.

The ECC module 17 extracts the user data, indicator INDI, and ECC fromthe sector data (read data) transferred by the read IC 16. Then, basedon ECC, ECC module 17 detects and corrects a possible error in the userdata to determine whether or not a read error has occurred. Here, forsimplification of description, a read retry operation is omitted.However, if sector data cannot be correctly read from the sectorindicated by RLBA, a read operation of reading sector data from thesector is generally retried. If the sector data cannot be correctly readeven with a given number of retries, that is, if the error in the userdata is uncorrectable, a read error is determined. The result of thedetermination made by the ECC module 17 is communicated to MPU 20.

ECC module 17 transfers the extracted user data and indicator INDI tothe indicator module 18. The indicator module 18 determines whether ornot the INDI [UNC] bit in the indicator INDI is “1” (IND1 [UNC]=1). Theindicator module 18 then communicates the result of the determination toMPU 20. The indicator module 18 stores the user data provided with theindicator NDI in the buffer memory 19. Here, in the same sequence inwhich the sector data is read in block 504, the corresponding user datais stored in the buffer memory 19.

Based on the results of the determinations made by the ECC module 17 andthe indicator module 18, MPU 20 determines whether a read error has beendetected or “INDI [UNC]=1” has been detected (block 505). If neither aread error nor “INDI [UNC]=1” has been detected (No in block 505), MPU20, for example, increments the current RLBA by one in order to specifythe next read target sector (block 506).

MPU 20 determines whether or not the sector read has been executed up tothe end (that is, the final sector in the area A0) of the data block DBto be migrated, based on the incremented RLBA (block 507). If the sectorread has not been executed up to the end of the data block DB (No inblock 507), MPU 20 executes the sector read again (block 504). On theother hand, if a read error or “INDI [UNC]=1” has been detected (Yes inblock 505), MPU 20 proceeds to block 508. The read logical block addressRLBA where a read error or “INDI [UNC]=1” is detected is hereinafterreferred to as an error RLBA.

In block 508, MPU 20 executes a data write process of writing(migrating) the user data stored in the buffer memory 19 andcorresponding to the logical block addresses from WLBA through the“error RLBA-1” (that is, the normally read user data), to thecorresponding sectors in the area A2 in units of sectors (block 508).

In this data write process (block 508), the indicator module 18sequentially reads the user data corresponding to the logical blockaddresses from WLBA through the “error RLBA-1”, from the buffer memory19. The indicator module 18 has been set to the first mode. In thiscase, the indicator module 18 adds the indicator INDI with “INDI[UNC]=0” (INDI [UNC] with the logical “0”), to the read user data.However, in the description below, for simplification, it is assumedthat except when the indicator INDI needs to be distinguished from theINDI [UNC] bit included in the indicator INDI, the INDI [UNC] bit (here,the INDI [UNC] bit with the logical “0”) is added to the user data. Thatis, it is assumed that the sector data comprises the user data, the INDI[UNC] bit and EEC. The indicator module 18 transfers the user dataprovided with the INDI [UNC] bit with the logical “0” (that is, INDI[UNC]=0), to the ECC module 17.

The ECC module 17 generates an ECC based on the user data transferred bythe indicator module 18 and provided with “INDI [UNC]=0”. The ECC module17 adds the generated ECC to the user data provided with “INDI [UNC]=0”.The ECC module 17 transfers the sector data including the user dataprovided with “INDI [UNC]=0” and ECC, to the read IC 16 as write data.The write data is written to the corresponding sector in the area A2 bythe head 12 via the read IC 16 and the head amplifier. In accordancewith this write, the write logical block address WLBA is incremented byone. Thus, when the data write process (block 508) is finished, thewrite logical block address WLBA equals the current read logical blockaddress RLBA, that is, the error RLBA.

When the data write process (block 508) is finished, MPU 20 sets theindicator module 18 to a second mode in which the indicator module 18adds the INDI [UNC] bit with the logical “1” (that is, INDI [UNC]=1) tothe user data (block 509). Then, MPU 20 executes data write for writingthe user data stored in the buffer memory 19 and corresponding to theerror RLBA (that is, the user data determined to involve a read error orINDI [UNC]=1), to the corresponding sector (that is, the sector in thearea A2 which is indicated by WLBA matching the error RLBA) in the areaA2 (block 510).

In this data write (block 510), the indicator module 18 reads the userdata corresponding to the error RLBA from the buffer memory 19. Theindicator module 18 has been set to the second mode. In this case, theindicator module 18 adds “INDI [UNC]=1” to the read user data. Thus, inthe data write (block 510), the sector data including the user dataprovided with “INDI [UNC]=1” and ECC is written to the sector in thearea A2 which is indicated by WLBA matching the error RLBA. Uponfinishing the data write (block 510), MPU 20 increments each of thewrite logical block address WLBA and the read logical block address RLBAby one (blocks 511 and 512). Then, MPU 20 returns to block 5503.

On the other hand, if the sector read has been executed up to the end ofthe data block DB (Yes in block 507), MPU 20 executes data write forwriting the sector data to the sector indicated by the current writelogical block address WLBA (block 513). In this data write (block 513),the indicator module 18 reads the user data corresponding to the logicalblock address WLBA from the buffer memory 19. In this case, theindicator module 18 adds “INDI [UNC]=0” to the read user data. Thus, inthe data write (block 513), the sector data including the user dataprovided with “INDI [UNC]=0” and ECC is written to the sector in thearea A2 which is indicated by the logical block address WLBA.

Upon finishing the data write (block 513), MPU 20 increments the writelogical block address WLBA by one (block 514). MPU 20 then determineswhether or not the data write has been executed up to the end (that is,the final sector in the area A2) of the data block DB, based on theincremented WLBA (block 515). If the data write has not been executed upto the end of the data block DB (No in block 515), MPU 20 executes thedata write again (block 513). In contrast, if the data write has beenexecuted up to the end of the data block DB (Yes in block 515), MPU 20terminates the data block migration process.

Now, the procedure of a data read process applied in the firstembodiment will be described with reference to a flowchart in FIG. 6.First, it is assumed that the host 100 issues a read command specifyingread of a certain data block (data) to the controller CNT in HDD 10. Thedata block is specified by a read access range indicated by the leadinglogical block address (leading LBA) of the data block and the datalength (for example, the number of sectors) of the data block.

MPU 20 in the controller CNT sets the read logical block address RLBAspecifying the read target sector to be the leading LBA of the readaccess range (block 601). Then, MPU 20 executes sector read for readingsector data from the sector indicated by the current read logical blockaddress RLBA (block 602).

Based on the ECC included in the sector data, the ECC module 17 detectsand corrects a possible error in the user data included in the sectordata read by the sector read. By detecting and correcting a possibleerror in the user data, the ECC module 17 determines whether or not aread error such as a read uncorrectable error has occurred. Theindicator module 18 determines whether or not the INDI [UNC] bitincluded in the read sector data is “1” (INDI [UBC]=1). MPU 20determines whether or not “INDI [UNC]=1” has been detected, based on theresult of the determination made by the indicator module 18 (block 603).MPU 20 also determines whether or not a read error has been detected,based on the results of the determination made by the ECC module 17(block 604).

If “INDI [UNC]=1” has not been detected (No in block 603) and no readerror has been detected (No in block 604), MPU 20, for example,increments RLBA by one and proceeds to block 605. In block 605, MPU 20determines whether or not there remains any data to be read. If thereremains any data to be read (Yes in block 605), MPU 20 returns to block602 to execute the sector read again. In contrast, if there remains nodata to be read (No in block 605), that is, if the sector read has beenexecuted up to the end of the specified data block, MPU 20 proceeds toblock 606. In block 606, MPU 20 executes a normal termination processfor reporting to the host 100 that the execution of the read command hasbeen finished normally.

On the other hand, if “INDI [UNC]=1” has been detected (Yes in block603) or if a read error has been detected (Yes in block 604), MPU 20proceeds to block 607. In block 607, MPU 20 executes error processingfor reporting to the host 100 that an error has occurred during theexecution of the read command from the host 100.

Thus, in the first embodiment, even if no read error has been detectedduring the read of the sector data from the sector (physical sector)specified by RLBA, that is, even if the sector data has been readnormally, when the INDI [UNC] bit is “1” (INDI [UNC]=1), errorprocessing is executed in the same manner as that used if a read erroris detected. For example, if the physical sector specified by RLBA isthe sector SA′ shown in FIG. 4, error processing is executed becauseeven though the sector data itself stored in the sector SA′ can be readnormally, the sector data includes “INDI [UNC]=1”. The reason for thisis as follows: even though the data itself stored in the sector SA′specified by RLBA (the sector SA′ to which RLBA is assigned) can be readnormally, the sector SA to which RLBA is previously assigned cannot beread. That is, the data written to the sector SA′ to which the data inthe sector SA is directly or indirectly migrated (in this case, thedirect migration destination) is different from the data stored in thesector SA and is invalid.

That is, according to the first embodiment, in an HDD configured tocontrollably rewrite a data block with a certain length and typified byan HDD to which shingled write is applied, the indicator INDI includingthe INDI [UNC] bit indicative of the read uncorrectable property isembedded in each sector data written to the disk. That is, if the sectordata for which a read operation has resulted in an error is included inthe data block not rewritten yet, the attribute information (pendinginformation) indicating the inclusion and relating to the rewrite of thesector is embedded in the sector data in the write destination. Thus,even if the physical position of the sector in which the sector data isstored is changed, this information can be inherited. This eliminatesthe need to manage the information using, for example, a managementtable.

Second Embodiment

Now, a second embodiment will be described with reference to FIG. 1.That is, the configuration (hardware configuration) of a magnetic diskdrive (HDD) according to the second embodiment is the same as thataccording to the first embodiment. Furthermore, shingled write isapplied to HDD 10. The second embodiment is different from the firstembodiment in the configuration of an indicator INDI.

FIG. 7 shows an example of a sector data format applied in the secondembodiment. As in the case of the first embodiment, the sector mainlycomprises a user data field, an indicator (INDI) field, and an ECCfield. In the second embodiment, the indicator INDI added to user dataincludes a write count (N). In this regard, the second embodiment isdifferent from the first embodiment in which the indicator INDI includesthe INDI [UNC] bit (write uncorrectable bit). Because of thisdifference, a data block migration process and a data read processapplied in the second embodiment involve procedures different from thosein the first embodiment. In the description below, it is assumed thatfor simplification, the write count (N) is added to the user data exceptwhen the indicator INDI needs to be distinguished from the write count(N) included in the indicator INDI. That is, it is assumed that sectordata comprises the user data, the write count (N), and ECC. The writecount is expressed as INDI [N].

The procedure of the data block migration process applied in the secondembodiment will be described below with reference to a flowchart in FIG.8. By way of example, a data block DB is migrated from an area A0 to anarea A2 as in the case of the first embodiment. It is assumed that thedata block migration process has been executed up to the final sectorwithout power shutdown; in the data block migration process, a datablock is migrated from a certain area (migration source area) to anotherarea (migration destination area) A2 in a group G0. Alternatively, it isfurther assumed that even when power shutdown occurs during the datablock migration process, a data recovery process described below isexecuted to completely migrate the data from a sector where the process(data write) has been suspended as a result of the power shutdown to thefinal sector in the area A2. In any case, INDI [N] (write count)contained (embedded) in the sector data stored in all the sectors in thearea A2 is equal.

Thus, MPU 20 reads sector data from, for example, the leading sector inthe area (migration destination area) A2 to acquire INDI [N] from thesector data (block 801). Furthermore, given that the INDI [N] has avalue n, INDI [N] with the value n is expressed as “INDI [N]=n”. Then,MPU 20 executes migration source data read for reading the data block DBstored in the area (migration source area) A0, for example, in units ofsectors (block 802). The user data in the sector data read as a resultof the migration source data read is sequentially stored in a buffermemory 19.

Then, MPU 20 adds 1 to INDI [N] (=n) acquired in block 801 (INDI[N]=n+1), and sets “INDI [N]=n+1”, which corresponds to NDI [N] (=n) towhich 1 has been added, in an indicator module 18 (block 803). MPU 20thus instructs the indicator module 18 to add “INDI [N]=n+1” to the userdata. Then, MPU 20 executes data write for writing (migrating) thesector data including the user data sequentially stored in the buffermemory 19 in the migration source data read (block 802), to the area(migration destination area) A2 (block 804). In this data write (block804), the indicator module 18 sequentially reads the user data stored inthe buffer memory 19 during the migration source data read (block 802).The indicator module 18 adds “INDI [N]=n+1” set by MPU 20 in block 803,to the read user data.

An ECC module 17 generates ECC based on the user data to which “INDI[N]=n+1” has been added. The ECC module 17 adds the generated ECC to theuser data to which “INDI [N]=n+1” has been added. The ECC module 17transfers the sector data including the user data provided with “INDI[N]=n+1” and ECC, to a read IC 16 as write data. The write data iswritten to the corresponding sector in the area A2 by a head 12 via theread IC 16 and a head amplifier. Thus, if the data block migrationprocess is executed up to the final sector without power shutdown, thesector data written (migrated) to each of all the sectors in the area A2includes the same INDI [N]=n+1″. That is, for all the sectors in thearea A2, INDI [N] (write count) is “n+1”.

In contrast, if power to HDD 10 is shut down during the data blockmigration process, INDI [N] (write count) is “n+1” for each of thesectors from the leading sector in the area A2 through a sectorpreceding the one where the power shutdown has occurred. However, INDI[N] (write count) is “n” for each of the sectors from a sectorsucceeding the one where the power shutdown has occurred through thefinal sector. FIG. 9 shows such a case in which the sector where thepower shutdown has occurred is located on a track TR_N+2 in the area A2.As is apparent from FIG. 9, by utilizing the difference in INDI [N](write count), the process can determine whether or not the powershutdown has occurred during the data block migration process andfurther identify the sector where the process has been suspended as aresult of the power shutdown.

Now, the procedure of the data read process applied in the secondembodiment will be described with reference to a flowchart in FIG. 10.First, it is assumed that a host 100 issues a read command specifyingread of a certain data block, to a controller CNT in HDD 10. It isassumed that the area to which the read access range indicated by theread command belongs is the area A2.

MPU 20 in the controller CNT reads sector data from, for example, theleading sector and final sector in the area A2 to which the read accessrange belongs, to acquire INDI [N] (write count) from the sector data inthe leading and final sectors (block 1001). In the description below,such reading of sector data for acquisition of INDI [N] is expressed asreading of INDI [N] for simplification. Here, INDI [N] for the leadingsector is assumed to be n1 (INDI [N]=n1). INDI [N] for the final sectoris assumed to be n2 (INDI [N]=n2).

MPU 20 determines whether or not “INDI [N]=n1” is equal to “INDI [N]=n2”(block 1002). If “INDI [N]=n1” is equal to “INDI [N]=n2” (Yes in block1002), MPU 20 determines that the data migration process of migrating adata block from a certain area (for example, A0) to the area A2 has beencompleted normally. MPU 20 then proceeds to block 1003. This normalcompletion includes the completion, by a data recovery process describedbelow, of a data migration process suspended as a result of powershutdown.

In block 1003, MPU 20 sets a read logical block address RLBA specifyinga read target sector to be the leading LBA of the read access range.Then, MPU 20 executes sector read for reading sector data from a sectorindicated by the current read logical block address RLBA (block 1004).Based on the ECC included in the sector data, the ECC module 17 detectsand corrects a possible error in the user data included in the sectordata read by the sector read. The ECC module 17 thus determines whetheror not a read error has occurred. The result of the determination madeby the ECC module 17 is communicated to MPU 20.

Based on the result of the determination made by the ECC module 17, MPU20 determines whether or not a read error has been detected (block1005). If no read error has been detected (No in block 1005), MPU 20,for example, increments RLBA by one and then proceeds to block 1006. Inblock 1006, MPU 20 determines whether or not there remains any data tobe read. If there remains any data to be read (Yes in block 1006), MPUreturns to block 1004 to execute the sector read again. In contrast, ifthere remains no data to be read (No in block 1006), MPU 20 executes anormal termination process (block 1007). Furthermore, if a read errorhas been detected (Yes in block 1005), MPU 20 executes error processing(block 1008).

On the other hand, if “INDIK [N]=n1” is not equal to “INDI [N]=n2” (Noin block 1002), MPU 20 determines that for example, power shutdown hasoccurred during the data block migration process of migrating the datablock from the area A0 to the area A2 to prevent the data blockmigration process from being completed normally. In this case, MPU 20executes the data recovery process described below (block 1009).

At the beginning of the data recovery process, MPU 20 identifies thesector where the process has been suspended as a result of the powershutdown. The technique to identify the sector where the process hasbeen suspended as a result of the power shutdown will be described withreference to FIG. 9. MPU 20 first reads INDI [N] (write count) from theleading and final sectors on the leading track TR_N+1 in the area A2.MPU 20 compares INDI [N] read from the leading sector with INDI [N] readfrom the final sector to determine whether or not these two write countsare equal. In the example in FIG. 9, both INDI [N] read from the leadingsector and INDI [N] read from the final sector are “n+1” and are thusequal. In this case, MPU 20 determines that the data migration to thetrack TR_N+1 has been completed normally.

Then, MPU 20 reads INDI [N] from the leading and final sectors on thesecond track TR_N+2 in the area A2. MPU 20 compares INDI [N] read fromthe leading sector on the track TR_N+2 with INDI [N] read from the finalsector on the track TR_N+2 to determine whether or not these two writecounts are equal. In the example in FIG. 9, INDI [N] read from theleading sector on the track TR_N+2 is “n+1”, and INDI [N] read from thefinal sector on the track TR_N+2 is “n”. Thus, INDI [N] read from theleading sector on the track TR_N+2 is not equal to INDI [N] read fromthe final sector on the track TR_N+2. In this case, MPU 20 determinesthat the power shutdown has occurred during data migration to the trackTR_N+2. If the next track (TR_N+3) is present as in the case of thetrack TR_N+2, INDI [N] may be read from the leading sector on the trackTR_N+2 and the leading sector on the next track. Then, MPU 20 reads INDI[N] from the second sector on the track TR_N+2. MPU 20 determineswhether or not INDI [N] (=n+1) in the leading sector on the track TR_N+2is equal to INDI [N] in the second sector on the track TR_N+2.

MPU 20 repeats the above-described operation while sequentiallyswitching the read target sector on the track TR_N+2 until MPU 20detects INDI [N] that is not equal to INDI [N] (=n+1) in the leadingsector. In the second embodiment, it is assumed that when INDI [N] isread from a sector SB shown in FIG. 9, INDI [N] (=n) that is not equalto INDI [N] (=n+1) in the leading sector is detected. In this case, MPU20 determines the sector SB to be where the process has been suspendedas a result of the power shutdown during the data block migrationprocess.

Detecting the equality between INDI [N] in the leading sector and INDI[N] in the final sector on the track is not necessarily required. Toomit this detection, MPU 20 may repeat the operation of comparing INDI[N] (=n+1) in the leading sector in the area A2 (that is, the leadingsector on the track TR_N+1) with INDI [N] in the sectors in the area A2in order starting with the area A2, until MPU 20 detects INDI [N] thatis not equal to INDI [N] (=n+1) in the leading sector. That is, MPU 20may read INDI [N] from the sectors in the area A2 in order starting withthe leading sector to detect the first sector with the value of INDI [N]different from that of INDI [N] (=n+1) in the leading sector.

It is assumed that MPU 20 detects the sector SB on the sector trackTR_N+2 where the process has been suspended as a result of the powershutdown during the data block migration process. In this case, MPU 20executes a process for recovering the data in the sectors from thesector SB through the final sector on the track TR_N+4 (that is, thefinal sector in the area A2) utilizing the data in the correspondingsectors in the area A0. That is, MPU 20 executes a data migrationprocess for migrating the data in the sectors in the area A0 to thecorresponding sectors from the sector SB through the final sector on thetrack TR_N+4 (the data migration process has been suspended by the powershutdown). In the data migration process, INDI [N] with the value “n+1”,obtained by incrementing “n” by one, is contained in the sector datamigrated to the sectors from the sector SB through the final sector inthe area A2. Upon finishing the data recovery process (block 1009), MPU20 proceeds to block 1003.

In the second embodiment, as is the case with the first embodiment, oneof a plurality of areas belonging to a group is assigned as a freespace. The free space is utilized to execute data migration in units ofareas. In this case, the data migration can be achieved at a high speed.However, one free space is required for each group, reducing theutilization efficiency of the storage areas in the group. Thus, on eachtrack, data may be rewritten, for example, in units of sectors.

In HDD 10 to which shingled write is applied, if for example, the datain the first track is rewritten, at least one track is affected by therewrite of the data in the first track. Here, it is assumed that thesecond track is affected by the rewrite of the data in the first track.In this case, before the rewrite of the data in the first track isstarted, the data in each of the sectors of the second track needs to besaved (migrated) to, for example, a temporary save area.

When the rewrite of the data in the first track is completed, a rewriteprocess can be executed which writes the data in the second tracktemporarily saved to the temporary save area, to the second track again.The data in the second track is manageably saved to the temporary savearea at least until the rewrite process is completed. The rewrite of thedata in the second track is started after the data in each of thesectors of, for example, the third track, which is affected by therewrite of the second track, is temporarily saved to the temporary savearea.

If power shutdown occurs during the rewrite of the data in the secondtrack, the sector where the process has been suspended as a result ofthe power shutdown can be identified by a technique similar to thataccording to the first embodiment. In this case, the rewrite process canbe resumed using the data in the sectors from the identified sectorthrough the final sector of the second track.

In the second embodiment, the indicator INDI in each sector dataincludes the write count (INDI [N]). In the data block migrationprocess, a value is used which is obtained by incrementing the writecount (obtained before the migration of the data block) common to thesectors in the migration destination area. The value obtained byincrementing the write count need not necessarily be used. A valuedifferent from the write count obtained before the data migration(before the data rewrite) may be used. That is, instead of the writecount, an attribute value indicative of the attribute of the rewrite maybe used. In the data block migration process, an attribute valuedifferent from that obtained before the data migration may be used.

As described above, in the second embodiment, the attribute valueindicative of the attribute of rewrite, such as the write count (INDI[N]), is included in the indicator INDI embedded in each sector data.Thus, if power shutdown occurs during the rewrite of a data block, thesector where the process has been suspended as a result of the powershutdown can be easily identified.

Third Embodiment

Now, a third embodiment will be described with reference to FIG. 1. Thatis, it is assumed that the configuration of a magnetic disk drive (HDD)10 according to the third embodiment is the same as those of the firstand second embodiments. It is also assumed that shingled write isapplied to HDD 10 as is the case with the first and second embodimentsand that an indicator INDI with a write count (INDI [N]) is applied asis the case with the second embodiment.

Differences between the third embodiment and the second embodiment willbe described with reference to the drawings. In the third embodiment, apredetermined area on a disk 11 is used as a temporary storage area(cache area) in which write data is temporarily stored. The temporarystorage area is hereinafter referred to as a nonvolatile cache area. Thenonvolatile cache area is assumed not to belong to the group G0 or G1.

FIG. 11 shows that write data (data block) specified by a write commandfrom a host 100 is partly stored in a nonvolatile cache area 110reserved on the disk 11. MPU 20 sequentially writes (temporarily stores)the write data transferred by the host 100 to the nonvolatile cache area110 via a buffer memory 19. At this time, MPU 20 cyclically uses theportions of the nonvolatile cache area 110 in order starting from theleading position in a first-in first-out (FIFO) manner as shown byarrows 111 and 112. That is, the nonvolatile cache area 110 is used as aring buffer that utilizes FIFO. MPU 20 writes write data temporarilystored in the nonvolatile cache area 110, to an original write accessrange specified by MPU 20.

In HDD 10 to which shingled write is applied, even if for example, writeof data contained in one track is specified by a write command from thehost 100, the data in all the tracks in the area to which the one trackbelongs needs to be rewritten. That is, the data block migration processas applied in the first and second embodiments is required. In thiscase, when the data block migration process is completed, the completionof the write command is reported to the host 100. This degrades commandresponses.

In contrast, if write data specified by a write command from the host100 is written to the nonvolatile cache area 110 utilizing FIFO, thewrite data can be temporarily stored in the nonvolatile cache area 110at a high speed. In this case, at the moment when all of the specifiedwrite data is written to the nonvolatile cache area 110, the completionof the write command can be reported to the host 100. This improvescommand responses.

The write data temporarily stored in the nonvolatile cache area 110 issequentially read utilizing FIFO as is the case with read from thebuffer memory 19. The write data is then written to the write accessrange on the disk 11 specified by the corresponding write command. Thewrite is implemented by such a data block migration process as appliedin the first and second embodiments in order to migrate the data blocklocated in the area to which the write access range belongs (morespecifically, the data block obtained by replacing the data locatedwithin the write access range with write data) to a free space.

In the third embodiment, even when the specified write data is writtento the nonvolatile cache memory 110, INDI [N] with an incremented valueis embedded in the sector data. In FIG. 11, positions P1 and P2 on thenonvolatile area 110 correspond to the leading (start) and trailing(final) ends, respectively, of an area portion 113 in the nonvolatilearea 110 in which the specified write data (data block) is to betemporarily stored.

In the example in FIG. 11, a part of the specified write data has beenwritten from a sector located at a position P1 through a sector locatedimmediately before a position P3 between the positions P1 and P2.Furthermore, in FIG. 11, it is assumed that before the start of anoperation of writing the specified write data to the relevant sectorsstarting with the sector located at the position P1, the write count(INDI [N]) embedded in each of the sectors from the one located at theposition P1 through the one located immediately before the position P3is “n” (INDI [N]=n). In this case, when a part of the specified writedata is written from the sector located at the position P1 through thesector located immediately before the position P3, the write count (INDI[N]) embedded in each of the sectors from the one located at theposition P1 through the one located immediately before the position P3is “n+1” (INDI [N]=n+1).

Unlike normal areas on the disk 11, the sectors in the nonvolatile cachearea 110 do not have any sequentially assigned LBA. Thus, the positionof the write data stored in the nonvolatile cache area 110 in accordancewith the write command from the host 100 fails to correspond to theposition indicated by LBA specified by the write command. Hence, theposition of the write data in the nonvolatile cache area 110 needs to bemanageably associated with LBA indicative of the write destination ofthe write data, for example, in a management table.

Furthermore, for HDD to which the nonvolatile cache area 110 is applied,possible power shutdown during write of write data to the nonvolatilecache 110 area needs to be taken into account. Thus, for example, themanagement table may be updated when all of the write data is written tothe nonvolatile cache area 110. Additionally, sector data indicative ofcompletion of write may be written after the end of the write data (thefinal sector of the write data). However, this technique fails todetermine which of the sectors as counted from the leading write datacorresponds to the occurrence of power shutdown during data write. Thus,all of the write data is lost.

On the other hand, in an HDD of a type in which write data is writtendirectly to the position of LBA specified by the write command withoutthe use of the nonvolatile cache area 110 (this HDD is hereinafterreferred to as the current HDD), if power shutdown occurs during thewrite of the write data, the data has been updated which is stored up tothe sector preceding the one where the process has been suspended as aresult of power shutdown. That is, none of the data stored up to thesector preceding the one where the process has been suspended is lost.In this manner, the HDD behaves differently between the case where thenonvolatile cache area 110 is used and the case where the nonvolatilecache area 110 is not used. However, in the third embodiment, the writecount (INDI [N]) is embedded in the data written to the nonvolatilecache area 110, in units of sectors as is the case with the secondembodiment. Thus, as described below, loss of all of such write data asdescribed above can be avoided.

It is assumed that power shutdown occurs while the appropriate sectordata in the write data is being written to the sector locatedimmediately after the position P3 shown in FIG. 11. In this case, as isthe case with the second embodiment, a difference can be detectedbetween the write counts (INDI [N]) obtained before and after the sectorwhere the process has been suspended as a result of the power shutdown.That is, the sector where the process has been suspended as a result ofthe power shutdown can be identified. Thus, the integrity of the datalocated up to the sector preceding the one where the process has beensuspended can be ensured. This enables behavior equivalent to that ofthe current HDD.

Now, the procedure of a data write process for writing data to thenonvolatile cache area 110 which process is applied in the thirdembodiment will be described with reference to a flowchart in FIG. 12.It is assumed that the host 100 issues a write command specifying datawrite to a controller CNT in HDD 10 and that the write data specified bythe write command is stored in the buffer memory 19.

MPU 20 updates a management table (block 1201) before writing the writedata stored in the buffer memory 19 to the nonvolatile cache area 110 onthe disk 11. The update allows the position in the nonvolatile cachearea 110 to which the write data specified by the write command is to bewritten to be associated with LBA which indicates the original writedestination (write access range) of the write data specified by thewrite command.

Then, MPU 20 executes data write for sequentially writing the specifiedwrite data to the nonvolatile cache area 110 in units of sectorsstarting from a sector located after the end of the last write datastored in the nonvolatile cache area 110 (block 1202). In the datawrite, as is the case with the second embodiment, the write count (INDI[N]) with an incremented value is embedded in each of the sector datacorresponding to the write data.

Before the data written to the nonvolatile cache area 110 is written tothe original write access range on the disk 11, read of the data may bespecified by a read command from the host 100. Whether or not the dataspecified by the host 100 is present in the nonvolatile cache area 110can be determined by referencing the management bale. If the dataspecified by the host 100 is present in the nonvolatile cache area 110,a data read process for reading the data from the nonvolatile cache area110 is executed.

The procedure of a data read process for reading data from thenonvolatile cache area 110 which process is applied in the thirdembodiment will be described with reference to the flowchart in FIG. 13.First, MPU 20 sets a read logical block address RLBA specifying a readtarget sector to be the leading LBA of a read access range (block 1301).Then, MPU 20 executes sector read for reading sector data from a sectorin the nonvolatile cache area 110 corresponding to the current readlogical block address RLBA (block 1302). Here, the sector in thenonvolatile cache area 110 corresponding to RLBA can be identified byreferencing the management table.

An ECC module 17 detects and corrects a possible error in the user dataincluded in the sector data read by the sector read, based on ECCincluded in the sector data. By detecting and correcting a possibleerror in the user data, the ECC module 17 thus determines whether or nota read error has occurred. The result of the determination made by theECC module 17 is communicated to MPU 20.

MPU 20 determines whether or not INDI [N] (write count) included in thesector data read from the sector corresponding to RLBA is equal to INDI[N] included in the preceding sector (block 1303). If INDI [N] includedin the read sector data is equal to INDI [N] included in the precedingsector (Yes in block 1303), MPU 20 determines whether or not a readerror has been detected, based on the result of the determination madeby the ECC module 17 (block 1304).

If no read error has been detected (No in block 1304), that is, if INDI[N] included in the read sector data is equal to INDI [N] included inthe preceding sector and no read error has been detected, MPU 20, forexample, increments RLBA by one and proceeds to block 1305. In block1305, MPU 20 determines whether or not there remains any data to beread. If there remains any data to be read (Yes in block 1305), MPU 20returns to block 1302 to execute the sector read again. In contrast, ifthere remains no data to be read (No in block 1305), MPU 20 executes anormal termination process (block 1306). If MPU 20 executes block 1304next to block 1302 to detect no read error (No in block 1304), MPU 20may execute block 1303.

If INDI [N] included in the read sector data is not equal to INDI [N]included in the preceding sector (No in block 1303), MPU 20 determinesthe current read target sector to be the one where the process has beensuspended as a result of power shutdown during the write of the writedata to the nonvolatile cache area 110. Thus, MPU 20 executes errorprocessing (block 1307). In the error processing, MPU 20 can return, tothe host 100, a portion of the data within the read access rangespecified by the read command from the host 100 which is included in thesectors from the leading sector, from which data has already been readnormally, through the sector preceding the current read target sector.Furthermore, even when INDI [N] included in the read sector data isequal to INDI [N] included in the preceding sector (Yes in block 1303),if a read error is detected (Yes in block 1304), MPU 20 executes errorprocessing (block 1307).

As described above, in the third embodiment, even in the write data(data block) specified by the host 100 and temporarily stored in thenonvolatile cache area 110 (temporary storage area) on the disk 11, theindicator INDI is embedded in each of the sector data. Furthermore, theattribute value indicative of the attribute of rewrite, such as thewrite count (INDI [N]), is included in the indicator INDI in each sectordata. Thus, if power shutdown occurs during the write of write data tothe nonvolatile cache area 110, the sector where the process has beensuspended as a result of the power shutdown can be easily identified.Hence, even though HDD 10 uses the nonvolatile cache area 110, theintegrity of the data stored up to the sector preceding the one wherethe process has been suspended can be ensured, as is the case with thecurrent HDD, which does not use the nonvolatile cache area 110.

[Modification]

In the second and third embodiments, in addition to the write count(INDI[N]), the INDI (UNC) bit applied in the first embodiment may beincluded in the indicator INDI, as shown in FIG. 14.

According to the embodiments and modification, in an HDD configured tocontrollably rewrite a data block with a certain length and typified byan HDD to which shingled write is applied, the indicator indicative ofthe attribute relating to the rewrite of each sector data is embedded inthe sector data written to the disk. Thus, the attribute relating to therewrite of each sector data can be detected in the indicator without theuse of any management table. The attribute relating to the rewriteenables detection of a sector in which an error has occurred, forexample, a sector determined to contain invalid data as a result of aread error during the rewrite of a data block on the disk or a sectorwhere the process has been suspended as a result of shutdown of power toHDD during the rewrite of the data block.

Here, the rewrite of a data block is not necessarily limited to theupdate of the date block. For example, the data block rewrite includeswrite of a data block read from a first area on the disk to the firstarea or to a second area on the disk which is different from the firstarea. Such rewrite of a data block is executed in order to refresh thedata block.

The various modules of the systems described herein can be implementedas software applications, hardware and/or software modules, orcomponents on one or more computers, such as servers. While the variousmodules are illustrated separately, they may share some or all of thesame underlying logic or code.

While certain embodiments have been described, these embodiments havebeen presented by way of example only, and are not intended to limit thescope of the inventions. Indeed, the novel embodiments described hereinmay be embodied in a variety of other forms; furthermore, variousomissions, substitutions and changes in the form of the embodimentsdescribed herein may be made without departing from the spirit of theinventions. The accompanying claims and their equivalents are intendedto cover such forms or modifications as would fall within the scope andspirit of the inventions.

1. A magnetic disk drive comprising: a disk comprising a plurality ofdata sectors; a controller configured to perform a data rewrite, thedata rewrite comprising reading a first data block stored in the diskand writing a second data block corresponding to the first data block toa write destination on the disk; and an indicator module configured toembed an indicator indicative of an attribute associated with the datarewrite in each sector data in the second data block written to thewrite destination when the sector data is written to the writedestination.
 2. The magnetic disk drive of claim 1, wherein theindicator module is further configured to embed a first indicator in asecond sector data if a read error has occurred during read of a firstsector data in the first data block, wherein the second sector datacorresponds to the first sector data, and wherein the first indicatorcomprises a read uncorrectable bit indicative of a read error.
 3. Themagnetic disk drive of claim 2, wherein the controller is furtherconfigured to cause the indicator module to embed a second indicator ina fourth sector data in the second data block, the fourth sector datacorresponding to a third sector data in the first data block, whereinthe second indicator is configured to inherit the read uncorrectable bitof the first indicator if the third sector data is read and the firstindicator comprising the read uncorrectable bit is embedded in the readthird sector data.
 4. The magnetic disk drive of claim 3, wherein theindicator module is further configured to report a read error to thecontroller if the first indicator comprising the read uncorrectable bitis embedded in the read third sector data.
 5. The magnetic disk drive ofclaim 3, wherein the controller is configured to execute the datarewrite by shingled write.
 6. The magnetic disk drive of claim 1,wherein: a third data block is stored in the write destination for thesecond data block; an indicator is embedded in each sector data in thethird data block when the third data block is written; the indicatorsembedded in said each sector data in the third data block compriserewrite status data indicative of a first rewrite status; and theindicator module is configured to embed an indicator comprising rewritestatus data indicative of a second rewrite status different from thefirst rewrite status, in each sector data in the second data block. 7.The magnetic disk drive of claim 6, wherein the controller is configuredto detect that power to the magnetic disk drive has been shut downduring writing to the write destination for the second data block basedon detecting that rewrite status data embedded in a leading data sectorat the write destination differs from rewrite status data embedded in afinal sector data at the write destination.
 8. The magnetic disk driveof claim 6, wherein the controller is configured to detect a data sectorat the write destination, wherein the embedded rewrite status data inthe data sector has changed because the write was suspended based on thepower shutdown.
 9. The magnetic disk drive of claim 8, wherein: the diskcomprises a temporary storage area wherein write data specified by ahost is temporarily stored; the controller is further configured tocontrol writing of the write data to the temporary storage area; anindicator comprising rewrite status data indicative of a third rewritestatus is embedded in each sector data at a write destination in thetemporary storage area to which the write data is to be written; and theindicator module is further configured to embed an indicator comprisingrewrite status data indicative of a fourth rewrite status different fromthe third rewrite status in each sector data corresponding to the writedata.
 10. The magnetic disk drive of claim 6, wherein: the rewritestatus data indicative of the first rewrite status is a first writecount; and the rewrite status data indicative of the second rewritestatus is a second write count equal to the first write count plus one.11. A method for rewriting a data block in a magnetic disk drive, thedisk drive comprising a disk, the disk comprising a plurality of datasectors, wherein the method comprises: reading a first data block storedin the disk in units of data sectors; writing a second data blockcorresponding to the read first data block to a write destination on thedisk; and embedding an indicator indicative of an attribute associatedwith data rewrite in each sector data in the second data block writtento the write destination when sector data is written to the writedestination.